package com.zzyl.nursing.task;

import com.zzyl.nursing.service.IContractService;
import com.zzyl.nursing.service.IReservationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component("contractJob")
@Slf4j
public class ContractJob {
    @Autowired
    private IContractService contractService;

    @Autowired
    private IReservationService reservationService;

    public void updateContractStatusJob() {
        contractService.updateContractStatus();
        log.info("定时更新合同状态成功！");
        System.out.println("定时更新合同状态成功！" + LocalDateTime.now());
    }

    /**
     * 定时检查预约状态
     */
    public void updateReservationStatus() {
        reservationService.updateReservationStatus();
    }
}
